package it.tukano.swingdeco.event;

import java.awt.Component;
import java.awt.Point;
import java.awt.event.MouseEvent;
import javax.swing.SwingUtilities;

/**
 * Extended mouse event
 * @author pgi
 */
public class MouseEventExt {

    private final MouseEvent source;

    /**
     * Instance initializer
     */
    public MouseEventExt(MouseEvent source) {
        this.source = source;
    }

    public Point getPoint() {
        return source.getPoint();
    }

    public boolean isLeft() {
        return SwingUtilities.isLeftMouseButton(source);
    }

    public boolean isRight() {
        return SwingUtilities.isRightMouseButton(source);
    }

    public boolean isMiddle() {
        return SwingUtilities.isMiddleMouseButton(source);
    }

    public int getX() {
        return source.getX();
    }

    public int getY() {
        return source.getY();
    }

    public Component getComponent() {
        return source.getComponent();
    }

    public boolean isDoubleClick() {
        return source.getClickCount() >= 2;
    }
}
